package com.code.exam.common.content;

public class BaseContext {
    private static final ThreadLocal<Long> currentIdThreadLocal = new ThreadLocal<>();
    private static final ThreadLocal<String> roleThreadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        currentIdThreadLocal.set(id);
    }

    public static Long getCurrentId() {
        return currentIdThreadLocal.get();
    }

    public static void setRole(String role) {
        roleThreadLocal.set(role);
    }

    public static String getRole() {
        return roleThreadLocal.get();
    }

    public static void remove() {
        currentIdThreadLocal.remove();
        roleThreadLocal.remove();
    }
}